class YiheTellYouError(Exception):
    def __init__(self,n):
        self.n = n

try:
    n = input("请输入数字")
    if not n.isdigit():
        raise YiheTellYouError(n)
except YiheTellYouError as yh:
    print("YiheError:请输入数字。\n您输入的是：",yh.n)
else:
    print("未发生异常")